home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / docs / howto / doNeatStuffOnASymmetry < prev    next >
Encoding:
Text File  |  1992-12-14  |  12.8 KB  |  339 lines

  1.  
  2. -----------------------------------------------------------------------------
  3. From: sequent!fubar@uunet.uu.net
  4. Subject: how to do some Sequent stuff
  5. Date: Fri, 27 Jul 90 16:14:17 PDT
  6.  
  7.  
  8.     How to do lots of neat things on a Sequent
  9.  
  10. -----------------How to boot it:
  11.  
  12.     To boot a kernel from the Dynix disk (which was sd(0,0) when I
  13. last checked), you type:
  14.  
  15.     b sd(0,0)kernelname
  16.  
  17.     The Sprite kernel I left there was called "vmsprite."
  18.  
  19.     You may specify arguments as usual after the kernel name, e.g.,
  20.  
  21.     b sd(0,0)kernelname -f
  22.  
  23.     does a fastboot.
  24.  
  25.     The auto reboot functionality is controlled by the setting of
  26. the AUTO switch on the front panel.  If AUTO is off, the machine will
  27. not automatically boot after a crash or reset.  If AUTO is on, then
  28. boot string 0 will be executed to boot the machine.
  29.  
  30.     You cannot boot diskless, unless you want to write an 8K disk
  31. bootstrap that does the diskless stuff for you.
  32.  
  33.     There is (or was when I was there) a SCEDMON (The boot
  34. monitor, with a "*" prompt) quick reference card with most of the
  35. commands on it.
  36.  
  37. -----------------Everything you never wanted to know about the SCED:
  38.  
  39.     From SCEDMON, type:
  40.  
  41.     ra
  42.  
  43.     Which prints everything stored in the battery backed up RAM on
  44. the SCED.  The machine will respond with something like this:
  45.  
  46.  Date 90/07/27 22:43:30 UTC
  47.  boot flags: 0x0
  48.  boot 0: 0x0: zd(0,0)dynix
  49.  boot 1: 0x64000: zd(0,0)stand/dump zd(0,7) 8000 /dev/rzd0h 81920
  50.  scc:  0 pf=8020 tf=8020 baud=9600  *1 pf=80A0 tf=80A0 baud=9600
  51.  ileave=1  erase=^H  kill=^X  int=^P
  52.  system mode: wide, tsize 16, bsize 16, copy-back cache
  53.  
  54.     The "boot flags" is the default numeric argument to pass to
  55. the booted program.  Dynix uses this to set various boot conditions:
  56.  
  57. 0x01: ask for file name (interpreted by Dynix /boot program)
  58. 0x02: single user
  59. 0x04: don't sync
  60. 0x08: don't reboot (if auto is set), just halt (after program is done)
  61. 0x10: name given for /etc/init
  62. 0x20: firmware: don't start controller
  63. 0x40: firmware: don't init system
  64. 0x80: boot aux ("boot 1") boot name
  65. 0x100: firmware: only build config tables
  66. 0x200: boot with cache off (don't try this at home)
  67.  
  68. Some of the possible values are recognised by the SCED firmware,
  69. others by the Dynix kernel.  The Symmetry Sprite kernel ignores this
  70. number entirely, so not all of these will be effective under Sprite.
  71.  
  72.     The "boot 0" and "boot 1" fields are the stored boot strings.
  73. Normally, boot 0 will boot the OS, and boot 1 will boot the memory
  74. dumper.  You can change the boot strings with:
  75.  
  76.     wnD=string
  77.  
  78.     where "D" is boot name you want to fiddle with, and "string"
  79. is what you want it to be.  You can also boot Dynix and use the
  80. /etc/bootflags program.  You can't alter these things from Sprite
  81. because I haven't done the SCED console memory driver necessary for
  82. it.
  83.  
  84.     The "scc" line breaks down like this:
  85.  
  86.  scc:  0 pf=8020 tf=8020 baud=9600  *1 pf=80A0 tf=80A0 baud=9600
  87.  
  88.     Everything from the first "0" to the "*" is the data for the
  89. local console port, everything from the "1" to the end of the line is
  90. for the remote port.  The "*" is located either before the "0" or the
  91. "1," depending upon the setting of the front panel LOCAL and REMOTE
  92. switches.  "pf" and "tf" are the terminal flags word for the
  93. respective ports, 8020 is the default, 80A0 differs in that sending a
  94. BREAK down the line will do the equivalent of pressing the RESET front
  95. panel switch.  With 8020 set, a BREAK will do baud rate rotation,
  96. which isn't nearly as exciting.  The definition of each bit in the
  97. terminal flags word is given in the SCEDMON quick reference.  The
  98. "baud=9600" part of the line should be fairly self-explanatory.
  99.  
  100.     The "ileave" specifies whether or not memory interleave is on
  101. or off.  I've never messed with this, so I don't really know what
  102. happens if you change it.  The "erase," "kill," and "int" fields are
  103. the console erase, kill and interrupt characters active under SCEDMON.
  104. You can change them with the "we=C" "wk=C" and "wx=C" commands,
  105. respectively.  Note that hitting the interrupt character will stop the
  106. pre-boot self-tests.  Interrupting the tests this way may leave the
  107. machine in a weird state.
  108.  
  109.     I have not ever needed anything on the "system mode" line, I
  110. doubt you will either.  I'm not entirely sure what the data
  111. represents.
  112.  
  113.     BTW, one useful command not in the SCEDMON quick reference
  114. (well, not in mine anyway) is "zap."  This will completely reset the
  115. SCED, and is useful to me from time to time.
  116.  
  117. -----------------How to format a disk:
  118.  
  119.     There are 3 wren3 disks, sd0-sd2 ("sd" for Scsi Disk, I
  120. guess).  sd0 contains Dynix, you can leave that there, or not.  The
  121. Symmetry disk label goes in sector 15, which was probably a bad place
  122. to put it.  I believe sector 16 is empty, you might want to change all
  123. of the proper defines before you mess with the disks a lot.  Anyway, I
  124. brought a labeldisk program with me that should label the disk.  The
  125. partition tables for a wren3 are:
  126.  
  127.  
  128. part    start    length
  129. a    0    50
  130. b    50    106
  131. c     0    965
  132. d    156    50
  133. e    206    757
  134. f    0    0
  135. g    156    808
  136. h    0    0
  137.  
  138. which looks vaguely like:
  139.  
  140. 0 ---------------------- C len=965 -------------------------------- 964
  141. |               50               156              206                !
  142. | -- A len=50 --! -- B len=106 -- ! -- D len=50 -- ! -- E len=757 -- !
  143. |               !                 !                !                 !
  144. |               !                 ! --------- G len=808 -------------!
  145.  
  146.     If you change the partition tables on the disk label, the
  147. standalone disk boot and possibly the kernel as well will break.
  148.  
  149.     Once you label the disk properly, fsmake should do its thing
  150. without trouble.
  151.  
  152. -----------------How to set up to boot from Sprite disks
  153.  
  154.     There's a program in /sprite/src/boot/sdboot, that generates the
  155. 8K disk bootstrap.  Before I get into it, here's how the boot procedure
  156. goes:
  157.  
  158.     you type: "b sd(0,0)whatever" at SCEDMON.
  159.  
  160.     The SCED reads the first 16 sectors off of sd0 (or whichever
  161. disk you've specified), loads them in at 0, and begins executing at 0.
  162. The SMAGIC standalone magic number is really an i386 instruction to
  163. make this work properly.  Alert readers will note that the label lies
  164. in the last sector of this data, originally I was going to have the
  165. disk bootstrap using the label partition tables, but I ran out of code
  166. space, and it would've been difficult to relabel the disks on our
  167. machine.
  168.  
  169.     The code goes from 0, and jumps to the a_bootstrap field of the
  170. exec structure, which contains various i386 initialization things.
  171.  
  172.     From there, it loads in whichever kernel file you've
  173. specified, magically moves it to 0 and begins executing it.  The
  174. kernel file text must start at 0x4000, and the gap from the end of the
  175. exec struct to 0x4000 must be padded with zeroes.  This empty area is
  176. filled in with system configuration data by the SCED.
  177.  
  178.     Anyway, back to the disk boot.  The source directory
  179. (/sprite/src/boot/sdboot/sym.md) should contain a binary.  If you dd
  180. the first 15*512 bytes from this file onto the first 15 sectors of the
  181. raw device (which I'll tell you how to make in just a second), you
  182. should be able to boot Sprite kernels from any Sprite filesystem on
  183. that disk.
  184.  
  185. -----------------How to make devices for the sd disks
  186.  
  187.     The major numbers for the sd disks are the same as all of the
  188. other sd disks (DEV_SCSI_DISK, which I believe is 4).  The minor numbers
  189. go like this:
  190.  
  191. part    sd0    sd1    sd2
  192. a    0    8    16
  193. b    1    9    17
  194. c    2    10    18
  195. d    3    11    19
  196. e    4    12    20
  197. f    5    13    21
  198. g    6    14    22
  199. h    7    15    23
  200.  
  201.     ..and so on.
  202.  
  203.  
  204. ---------------------------------------------------------------------------
  205.  
  206.  
  207.     Everything we messed with for sequent support in the machine
  208. independant kernel sources should be inside "#ifdef sequent."  As I
  209. recall, there really wasn't that much.  
  210.  
  211.     In the regular sources, pretty much everything either just
  212. needed to be compiled, and was ok, or had stuff that went in separate
  213. directories (like cc1.sym).  There's some stuff in the C library that
  214. didn't go behind ifdefs (disk labels and the like, mostly), there
  215. should be RCS files for all the changes.  The RCS files I have are:
  216.  
  217. Disk.man,v      diskFragIO.c,v  diskIO.c,v
  218. disk.h,v        diskHeader.c,v  diskPrint.c,v
  219. pdev.c,v
  220. Sync_GetLock.s,v  Sync_Unlock.s,v
  221. fsStubs.s,v         profStubs.s,v       sysStubs.s,v        vmStubs.s,v
  222. netStubs.s,v        sigStubs.s,v        testStubs.s,v
  223. procStubs.s,v       syncStubs.s,v       userSysCallInt.h,v
  224.  
  225.  
  226.  
  227. ---------------------------------------------------------------------------
  228.  
  229. From: jhh@sprite.Berkeley.EDU (John H. Hartman)
  230. Date: Thu, 1 Nov 1990 10:45:57 PST
  231. Subject: news from fubar
  232.  
  233. I just got off the phone with fubar.  Here's what we talked about.
  234.  
  235. It looks possible to poll for an ethernet packet.  The routine 
  236. se_intr() in net/symm.md/netScedEther.c has a loop that processes all
  237. pending packets.  We just have to write a polling routine that does the
  238. same thing.
  239.  
  240. Sequent found a bug in gas 1.37 that caused it to drop a byte in the
  241. middle of a file.  This only happens if you specify an input file.
  242. It doesn't happen if you read from a pipe.  Symptoms usually are a
  243. syntax error, but it is possible you'd lose a byte out of a constant
  244. or something.
  245.  
  246. He's going to send us whatever hardware documentation he can get his 
  247. hands on.
  248.  
  249. ---------------------------------------------------------------------------
  250.  
  251. Subject: Re: debugging a kernel 
  252. Date: Fri, 19 Oct 90 12:49:09 PDT
  253. From: fubar@sequent.com
  254.  
  255. >What is the proper procedure for debugging a kernel?
  256.  
  257.     Well, about all you can really do is either load it up with
  258. printfs (yuk), or dump vmcores and run /usr/etc/crash or adb on them.
  259. Crash comes with Dynix, it hasn't got any documentation.  It knows all
  260. about Dynix proc structures and stacks and whatnot; about all you can
  261. do with it under Sprite is hex dump things.  I think it sucks.  Adb
  262. you're probably familiar with, for Sprite the only real advantage it
  263. has is that you can start a stacktrace at any arbitrary location
  264. (crash knows where the stack is "supposed to be," and won't go beyond
  265. those limits).  Adb doesn't come with Dynix, but I can give it to you
  266. if you want it (presumably its ok for you guys to have BSD sources).
  267.  
  268.     When Sprite panics under Dynix, it'll fill in a special structure
  269. that you can examine after the crash.  It's called panic_data, and
  270. it's found in mach/sym.md/machArchdep.c:
  271.  
  272. struct  panic_data {
  273.         int     pd_processor;           /* Panicing engine */
  274.         char    *pd_sp;                 /* sp to saved regs in panic frame */
  275.         char    *pd_dblsp;              /*sp to saved regs in dblpanic frame */
  276.         Proc_ControlBlock *pd_proc;     /* Panicing process, 0 if idle */
  277. };
  278.  
  279.     pd_processor is the processor number that initially panicked.
  280. pd_sp is the pointer to the saved regs for the initial panic (more on
  281. that in a bit), and pd_dblsp is the same thing, but for a double panic
  282. (two panics either sequentially on the same processor, or concurrently
  283. on two processors).  There's a global kernel variable called
  284. "dblpanic" that is set to 1 if a double panic occurs.  Anyway,
  285. finally, pd_proc is the Proc_ControlBlock for the executing process; I
  286. have some of the byte offsets of various important elements in this
  287. (processID at 0x44 and machStatePtr at 0xb0 are the two I used a lot).
  288.  
  289.     The pd_sp is set (as is all of this stuff) in MachPanic, in
  290. machArchdep.c.  It's the %esp register after a pushal instruction, so
  291. the registers are all tucked away just above it.  They're pushed in
  292. this order: %eax, %ecx, %edx, %ebx, %esp (before pushal began), %ebp,
  293. %esi, %edi.  In case you're not familiar with the 386 layout, %esp is
  294. the stack pointer, %ebp is the frame pointer, and %eip is the
  295. instruction pointer.
  296.  
  297.     The better way is to follow the pd_proc through the control
  298. block structure.  Look at Mach_State structure (pointer found at
  299. pd_proc + 0xb0), and follow it to the machTrapEntry structure.  This
  300. is the register set when the panic trap occured, and is probably the
  301. easiest way to find what you're after.
  302.  
  303.     One thing I did pretty often was a sort of checkpointing
  304. structure, e.g., once you know the approximate source of the trouble,
  305. set up something like:
  306.  
  307. struct XX {
  308.     int pc;
  309.     int somestate;
  310. } XX[512];
  311.  
  312. int XXptr = -1;
  313.  
  314. #define CKPOINT { XXptr = (XXptr == 511) ? 0 : XXptr + 1;
  315.           XX[XXptr]. pc = GetPC();
  316.         }
  317.  
  318. and spread those liberally about, then use crash/adb to go through
  319. that stuff in the vmcore.
  320.  
  321.     The other thing we did to make life easier was to run a serial
  322. line from a tty port on another machine to the "remote" console port
  323. on the Sprite machine.  If you then put the S27 on "Remote" (a front
  324. panel button), you can tip to that tty port, and it's the console.
  325.  
  326.     Oh, I don't know if I mentioned it elsewhere or not... to get
  327. a vmcore in the first place, you do 'b 80' at SCEDMON (the boot
  328. monitor).  This should work automagically, and put a crash dump in
  329. /usr/crash.  It'll choke on a Sprite kernel, but that's ok.
  330.  
  331.     If you have any troubles with this at all or whatever, feel
  332. free to call or email.  I can telnet in and poke around now, too,
  333. should the need arise.
  334.  
  335.     -J
  336.  
  337. ---------------------------------------------------------------------------
  338.  
  339.